//
//  DSXWebViewController.m
//  LADZhangWo
//
//  Created by Apple on 16/4/13.
//  Copyright © 2016年 Apple. All rights reserved.
//

#import "DSXWebViewController.h"

@implementation DSXWebViewController
@synthesize url = _url;
@synthesize request   = _request;
@synthesize webView   = _webView;
@synthesize indicator = _indicator;

- (instancetype)init{
    if (self = [super init]) {
        _webView = [[UIWebView alloc] init];
        _indicator = [[DSXActivityIndicator alloc] init];
    }
    return self;
}

- (void)setUrl:(NSURL *)url{
    _url = url;
    _request = [NSURLRequest requestWithURL:url];
    [_webView loadRequest:_request];
}

- (void)setRequest:(NSURLRequest *)request{
    _request = request;
    [_webView loadRequest:_request];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view setBackgroundColor:[UIColor clearColor]];
    
    _webView.frame = self.view.bounds;
    _webView.backgroundColor = [UIColor clearColor];
    _webView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight;
    [self.view addSubview:_webView];
}

- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    [_indicator hide];
}

@end